package org.vectrics.mail;



import org.apache.log4j.Category;


abstract public class MailSender {
    private static Category log = Category.getInstance(MailSender.class);
    //private Session theMailSession = null;

    public MailSender() {
    	super();
    }

//    abstract protected Session getMailSession();

/*
    public MimeMessage createTextMessage(String subject, String content) throws MailException {
        MimeMessage msg = null;
        log.debug("createTextMessage() called.");
        if (subject == null) {
            log.error("Subject was null in createTextMessage() - body = " + content);
        } else {
	        try {
	            msg = new MimeMessage(getMailSession());
	            msg.setSubject(subject);
	            msg.setContent(content, "text/plain");
	            msg.setSentDate(new Date());
	        }
	        catch (javax.mail.MessagingException me) {
	            msg = null;
	            log.error("Exception creating MIME message.", me);
	            throw new MailException("Exception creating MIME message.", me);
	        }
        }
        return(msg);
    }

    public MimeMessage createHtmlMessage(String subject, String content) throws MailException {
        log.debug("createHtmlMessage() called.");
        MimeMessage msg = null;
        if (subject == null) {
               throw new MissingSubjectMailException("Subject missing from message.");
        }
        
        try {
            msg = new MimeMessage(getMailSession());
            msg.setSubject(subject);
            msg.setContent(content, "text/html");
            msg.setSentDate(new Date());
            log.debug("createHtmlMessage() - content type = " + msg.getContentType());
        }
        catch (javax.mail.MessagingException me) {
            msg = null;
            log.error("Exception creating MIME message.", me);
            throw new MailException("Exception creating MIME message.", me);
        }
        return(msg);
    }
*/
}